package day09;

/*
 * Author: JacksonCoder
 * FileName: DateFormatExample
 * Version: 1.0.0
 * Date: 2025/4/15
 */

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * SimpleDateFormat 是线程不安全的。
 */
public class DateFormatExample {

    public static void main(String[] args) throws InterruptedException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String now = sdf.format(new Date());
        System.out.println("当前时间: " + now);

        Thread t = new Thread();
        t.sleep(2000);
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String now1= sdf.format(new Date());
        System.out.println("当前时间: " + now1);

    }

}
